Skip to content

Conversation

@hokein
Copy link
Owner

@hokein hokein commented Jul 8, 2025

No description provided.

hokein added 10 commits July 8, 2025 09:03
See the discussion in llvm#145529.

This will slightly increase the PCM size (~5%), some data (in-memory
preamble size in clangd):

- SemaExpr.cpp: 77MB  -> 80MB
- FindTarget.cpp: 71MB -> 75MB
…46412)

Converting back and forth for the source location raw encoding is
unnecessary.
This patch stops storing a source range in `CXXOperatorCallExpr` and
keeps only the begin location.

This change allows us to retain the optimization llvm#141058 when switching
to 64-bit source locations.

Performance results:

https://llvm-compile-time-tracker.com/compare.php?from=0588e8188c647460b641b09467fe6b13a8d510d5&to=5958f83476a8b8ba97936f262396d3ff98fb1662&stat=instructions:u
fix

Reduce the Stmt size back to 8 bytes.

Reduce the CallExpr size

Fix the ObjCContainerDecl bit field

Change the SourceLocation::UIntTy to uint64_t

Update other SourceManager's getDecomposedSpellingLoc APIs, and fix many
failing tests.

Remaining failures:

  Clang :: Index/IBOutletCollection.m
  Clang :: Index/annotate-macro-args.m
  Clang :: Index/annotate-module.m
  Clang :: Index/annotate-tokens-pp.c
  Clang :: Index/annotate-tokens.c
  Clang :: Index/annotate-toplevel-in-objccontainer.m
  Clang :: Index/hidden-redecls.m
  Clang :: Index/index-module-with-vfs.m
  Clang :: Index/index-module.m
  Clang :: Index/index-pch-objc.m
  Clang :: Index/index-pch-with-module.m
  Clang :: Index/index-pch.cpp
  Clang :: Index/targeted-annotation.c
  Clang :: Lexer/SourceLocationsOverflow.c
  Clang-Unit :: ./AllClangUnitTests/PPMemoryAllocationsTest/PPMacroDefinesAllocations
  Clang-Unit :: ./AllClangUnitTests/SourceLocationEncoding/Individual
  Clang-Unit :: ./AllClangUnitTests/SourceLocationEncoding/Sequence
  Clang-Unit :: libclang/./libclangTests/14/53
  Clang-Unit :: libclang/./libclangTests/45/53
  Clang-Unit :: libclang/./libclangTests/47/53
  Clang-Unit :: libclang/./libclangTests/48/53
  Clang-Unit :: libclang/./libclangTests/49/53
  Clang-Unit :: libclang/./libclangTests/50/53
  Clang-Unit :: libclang/./libclangTests/52/53

Fix libclang failures

Fix Rewrite APIs

Fix PPMemoryAllocationsTest

Fix SourceLocationEncodingTest

More unsigned -> SourceLocation::UIntTy changes in the SourceManager APIs

Update the type of std::pair<FileID, unsigned> in CIndex.cpp

Fix SourceLocationEncodingTest

Tweak the SourceLocation Implementation.

The source location has a Bit which specify the number of bits used
for the offset. 40 by default;

Make MathExtra templates constexpr

Test Bits=64 perf

Try 48 bits

No bitfields

Fix CallExpr optimization.

Test Bits=64 perf

Switch Bits back to 40.

Reduce SubstNonTypeTemplateParmExpr size: 48 -> 40 bytes

Reduce OpaqueValueExpr: 32 -> 24 bytes

Reduce CXXDependentScopeMemberExpr size: 88 -> 80 bytes

Reduce DeclRefExpr size: 48 -> 40 bytes.

by moving out the two source locations for CXXOpName from DeclarationNameLoc

Fix some merge conflicts.

Move the Loc back to the StmtBitFields if possible to save AST size.

Improve getFildIDLocal binary search.

Optimize binary search by using a dedicate offset table

improve the cache performance

Revert the static_assert change for ObjCContainerDeclBitfields.

Fix the compile failures for include-cleaner.

Fix clang-tidy build.

Fix clangd unittest

Fix windows build failures.

unsigned long is 32 bits on MSVC

More windows fix

Change the underlying StmtBitField type to uint64_t, fix windows
failures.

So that the sizeof(Stmt) can stay with 8 bytes.

More window fix

Fix merge failures

Update comments for SourceLocation.

clang-format

revert the Rewrite change.

Don't change the FileIDAndOffset type.

Revert the change in ObjCContainerDeclBitfields

Revert the changei n HTMLReport.cpp

Revert the unsigned -> UIntTy change in Diagnostic.h

Revert the unsigned->UIntTy change in SourceManager.

revert the binary optimization change.

clang-format

More cleanup

Cleanup some unnecessary change.

Get rid of the Range in CXXOperatorCallExpr.

revert unintentional changes.

Remove unintentional change.

Revert unintentional changes.
so that they can be evaluated at compiler time (we can see these values
in hover via clangd).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants